<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$item=$this->plugin_setting('setting');
$return['adv']=$item['hdps'];
$return['footernav']=$item['footernav'];
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_SESSION['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'inuid'=>$_SESSION['uid']);
	$fields=array('id','remark','status','createtime','pid');
    $orderby='createtime desc';
	$total='';
	$return['list']=pdo_getslice('jy_cmspinche_log',$params,array($pindex,$psize),$total,$fields,'',$orderby);
	foreach($return['list'] as &$v){
		if($v['status']==0){
			$v['status']='未接受';
		}elseif($v['status']==1){
			$v['status']='已接受';
		}
		$v['createtime']=date('Y-m-d H:m:s',$v['createtime']);
		$p=pdo_get('jy_cmspinche_list',array('id'=>$v['pid']),array('title','start','end','time','type','name','mobile'));
		
		if($p['type']==1){
			$p['type']='拼车';
		}
		if($p['type']==2){
			$p['type']='带客';
		}
		$v=array_merge($v,$p);
	}
	
	exi($return);
	}
if($_RQ['op']=='cel'){
	$id=intval($_RQ['id']);
	if(!$id){
		exi('请先选择项目','error');
	}
	$status=pdo_getcolumn('jy_cmspinche_log',array('id'=>$id),'status');
	if($status==3){
		exi('已接受无法取消','error','mycanyu/');
	}
	pdo_update('jy_cmspinche_log',array('status'=>2),array('id'=>$id));
	exi('已取消','','mycanyu/');
}
?>